package com.ymttest.database.sqlwapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.YmtC2CLiveActivity;
import com.ymttest.utils.EnvSetup;

/************************************************************************************
 * @File name : YmtC2CLiveActivityWapper.java 用来处理C2C直播 ActivityWapper
 * @Author : sunsheng
 * @Date : 2015年10月22日
 * @Copyright : 洋码头
 ************************************************************************************/

public class YmtC2CLiveActivityWapper {
	SqlManager manage;

	public YmtC2CLiveActivityWapper() {
		manage = new SqlManager("app" + EnvSetup.getEnv());
	}

	/**
	 * 获取直播信息list
	 * 
	 * @param
	 * @return liveActivityList
	 * @throws InterruptedException
	 */
	public List<YmtC2CLiveActivity> getsLiveActivity() throws InterruptedException {
		List<YmtC2CLiveActivity> liveActivityList = manage.getSelectResults(
				"com.ymttest.database.mapping.YmtC2CLiveActivityMapper.selectLiveActivity", null);
		return liveActivityList;
	}
	public List<Map> getsc2cLiveBizer() throws InterruptedException {
		List<Map> liveActivityList = manage.getSelectResults(
				"com.ymttest.database.mapping.YmtC2CLiveActivityMapper.selectLiveActivityByParam",null);
		return liveActivityList;
	}

	/**
	 * 根据条件直播信息list 可以传 CountryGroupId,LiveActivityId 2个参数
	 * 
	 * @param
	 * @return liveActivityList
	 * @throws InterruptedException
	 */
	public List<Map> getsLiveActivity(Map m) throws InterruptedException {
		List<Map> liveActivityList = manage.getSelectResults(
				"com.ymttest.database.mapping.YmtC2CLiveActivityMapper.selectLiveActivityByParam", m);
		return liveActivityList;
	}

	
	public List<Map> selectLiveActivityByiActivityId(int iActivityId) throws InterruptedException {
	    @SuppressWarnings("unchecked")
	    List<Map>  livelist = manage.getSelectResults(
	            "com.ymttest.database.mapping.YmtC2CLiveActivityMapper.selectLiveActivityByiActivityId", iActivityId);
//	    manage.commit();
	    return livelist;
	}
	
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Map m = new HashMap();
		// 1:北美，2：欧洲，3：亚洲，4：澳新
		m.put("CountryGroupId", 3);
		m.put("LiveActivityId", 0);
		try {
			Logger.debug(new YmtC2CLiveActivityWapper().selectLiveActivityByiActivityId(153987));
			
		} catch (InterruptedException e) {

			e.printStackTrace();

		}

	}

}
